package top.jle.wx.proxy.feign.invoice;

import com.alibaba.fastjson2.JSONObject;
import top.jle.wx.proxy.config.FeignMultipartSupportConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(url = "https://api.weixin.qq.com",name = "Invoice",configuration = FeignMultipartSupportConfig.class)
public interface InvoiceAPIFeign {

    /**
     * 创建发票卡券模板
     * @param cardInfo
     * @return
     */
    @PostMapping("/card/invoice/platform/createcard")
    JSONObject createCard(@RequestBody JSONObject cardInfo);

    /**
     * 上传电子发票PDF
     * @param pdf
     * @return
     */
    @PostMapping(value = "/card/invoice/platform/setpdf",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    JSONObject uploadPDF(@RequestPart("pdf") MultipartFile pdf);

    /**
     * 获取上传的PDF信息
     * @param pdfInfo
     * @return
     */
    @PostMapping(value = "/card/invoice/platform/getpdf?action=get_url")
    JSONObject getPDF(@RequestBody JSONObject pdfInfo);

    /**
     * 将电子发票插入用户卡包
     * @param invoiceInfo
     * @return
     */
    @PostMapping(value = "/card/invoice/insert")
    JSONObject insert(@RequestBody JSONObject invoiceInfo);
}
